<?php

class AcctGeneralLedgerTable extends Doctrine_Table
{
    
    public function getGeneralLedgerByOption($options)
    {
        $q = $this->getGeneralLedgerQuery();

        foreach($options as $field => $value)
        {
            $q->addWhere( $field . " = ? ", $value);
        }
        
        return $q->execute();
        

    }


    public function getGeneralLedgerQuery($query = null) {
        if(is_null($query))
        {
            $query = $this->createQuery();
        }

        $query->addWhere("acct_set_id = ?",sfContext::getInstance()->getUser()->getAttribute("acct_set") );

        return $query;

    }

}
